package com.logansoft.servicehomework.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author liqiye
 * @description 用户
 * @date 2021/7/14
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

    // AUTO：自增、NONE没有主键、INPUT手动输入、ID_WORKER：默认的全局唯一Id(雪花算法)、UUID：uuid、ID_WORKER_STR：字符串的id
    // @TableId(type = IdType.AUTO)
    private Long id;

    private String name;

    private Integer age;

    private String email;

    @Version  // 乐观锁
    private Integer version;

    // 填充内容，自动填充新建时间，需要编写一个 MetaObjectHandler 实现类
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

}
